package com.yz.rabbitmq.exchange.topic;

import com.rabbitmq.client.Channel;
import com.yz.rabbitmq.ChannelsUtil;

import java.io.IOException;

/**
 * 描述：
 **/
public class TopicExchangePro {

    public static void main(String[] args) {
        Channel channel = ChannelsUtil.getChannel();
                try {
                    String routingKey = "usa.news";
                    byte[] msg = routingKey.getBytes();
                    channel.basicPublish("topicExchange",routingKey,null,msg);
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    ChannelsUtil.closeChannel(channel);
                }
    }
}
